package com.tbit.api;

import com.tbit.manager.api.MachineOAApi;
import com.tbit.manager.api.dto.MachineOperationsStatDTO;
import com.tbit.manager.api.dto.MachineStatReturnDTO;
import com.tbit.uqbike.service.business.operationsanalysis.MachineOAService;
import com.tbit.utils.DateTimeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController
public class MachineOAApiImpl implements MachineOAApi {

    @Autowired
    private MachineOAService machineOAService;

    /**
     * @description: 获取产生订单的车辆折线表数据
     * @author: mo.shanyong
     * @date: 2025/3/4 9:25
     * @param: accountId 区域id
     * @param: startDate 开始时间
     * @param: endDate 结束时间
     * @return: java.util.List<com.tbit.manager.api.dto.MachineStatReturnDTO>
     */
    @Override
    public List<MachineStatReturnDTO> getOrderCarLineData(Integer accountId, String startTime, String endTime) {
        return machineOAService.getOrderCarLineData(accountId, startTime, endTime);
    }

    /**
     * @description: 按照短、中、长获取车辆闲置折线图数据
     * @author: mo.shanyong
     * @date: 2025/3/4 9:29
     * @param: accountId 区域id
     * @param: startDate 开始时间
     * @param: endDate 结束时间
     * @return: com.tbit.uqbike.object.pojo.MachineOperationsStat
     */
    @Override
    public List<MachineOperationsStatDTO> getIdleCarLineData(Integer accountId, String startDate, String endDate) {
        return machineOAService.getIdleCarLineData(accountId, startDate, endDate);
    }

    /**
     * @description: 获取计费车辆分布折线图数据
     * @author: mo.shanyong
     * @date: 2025/3/4 10:01
     * @param: accountId 区域id
     * @param: startDate 日期：2025-03-01
     * @param: endDate 日期：2025-03-01
     * @return: java.util.List<com.tbit.manager.api.dto.MachineStatReturnDTO>
     */
    @Override
    public List<MachineStatReturnDTO> getChargingCarLineData(Integer accountId, String startDate, String endDate) {
        return machineOAService.getChargingCarLineData(accountId, startDate, endDate);
    }

    /**
     * @description: 低电占比折线图
     * @author: mo.shanyong
     * @date: 2025/3/4 14:18
     * @param: accountId 区域id
     * @param: startDate 开始时间
     * @param: endDate 结束时间
     * @return: java.util.List<com.tbit.manager.api.dto.MachineStatReturnDTO>
     */
    @Override
    public List<MachineStatReturnDTO> getBatteryLineData(Integer accountId, String startDate, String endDate) {
        return machineOAService.getBatteryLineData(accountId, DateTimeUtil.StringToDateTime(startDate), DateTimeUtil.StringToDateTime(endDate));
    }
}
